package com.yan.demo.array;

import java.util.Scanner;

public class ArrayDemo6 {
    public static void main(String[] args) {
        int[] class1 = new int[3];
        int[] class2 = new int[4];
        int[] class3 = new int[2];
        Scanner input = new Scanner(System.in);
        for (int i = 0; i < class1.length; i++) {
            System.out.println("请输入第"+(i+1)+"个学生成绩");
            class1[i] = input.nextInt();
        }
        for (int i = 0; i < class2.length; i++) {
            System.out.println("请输入第"+(i+1)+"个学生成绩");
            class2[i] = input.nextInt();
        }
        for (int i = 0; i < class3.length; i++) {
            System.out.println("请输入第"+(i+1)+"个学生成绩");
            class3[i] = input.nextInt();
        }
        int[][] school = new int[3][];
       school[0] = class1;
       school[1] = class2;
       school[2] = class3;
        for (int i = 0; i < school.length; i++) {
            int[] clazz = school[i];
            double sum = 0.0;
            for (int score : clazz) {
                sum = sum + score;
            }
            System.out.println("第"+(i+1)+"个班级的平均分为" + sum / clazz.length);
        }
    }
}
